from pydantic import BaseModel
from typing import List, Optional
from datetime import datetime

class ConfigBase(BaseModel):
    client_type: str
    host: str
    port: int
    username: str
    password: str
    enabled: bool = True

class ConfigCreate(ConfigBase):
    pass

class Config(ConfigBase):
    id: int

    class Config:
        from_attributes = True

class ScanPathBase(BaseModel):
    path: str
    enabled: bool = True

class ScanPathCreate(ScanPathBase):
    pass

class ScanPath(ScanPathBase):
    id: int
    created_at: datetime

    class Config:
        from_attributes = True

class ScanResultBase(BaseModel):
    file_path: str
    file_name: str
    file_size: int
    status: str

class ScanResultCreate(ScanResultBase):
    pass

class ScanResult(ScanResultBase):
    id: int
    created_at: datetime
    action_time: Optional[datetime] = None

    class Config:
        from_attributes = True

class ScanRequest(BaseModel):
    path_ids: Optional[List[int]] = None  # 如果为空，则使用所有启用的路径
